package spindles.api.domain;

import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.Locale;

import org.apache.commons.lang.builder.ToStringBuilder;

public class PerformanceEvaluation {
	
	private int hits;
	private int misses;
	private int fp1;
	private int fp2;
	
	private String personName;
	private String epoch;
	private String part;
	
	private NumberFormat format; 
	
	
	public PerformanceEvaluation(){
		format = NumberFormat.getInstance(Locale.ENGLISH);
		((DecimalFormat)format).applyLocalizedPattern("##.##");
	}
	
	public String getHitsPercentage(){
		return format.format(((double)hits/(hits + misses)) * 100);
	}
	
	public String getTotalFPPercentage(){
		return format.format(((double)(fp1 + fp2)/(hits + fp1 + fp2)) * 100);
	}
	
	public String getFP1Percentage(){
		return format.format(((double)fp1/(hits + fp1 + fp2)) * 100);
	}
	
	public String getFP2Percentage(){
		return format.format(((double)fp2/(hits + fp1 + fp2)) * 100);
	}
	
	public void addFP1(int num){
		fp1 += num;
	}

	
	public void incrementFP1(){
		fp1++;
	}
	
	public int getFP1() {
		return fp1;
	}
	
	public void addFP2(int num){
		fp2 += num;
	}

	public void incrementFP2(){
		fp2++;
	}
	
	public int getFP2() {
		return fp2;
	}
	
	public void addHits(int num){
		hits += num;
	}
	
	public void incrementHits(){
		hits++;
	}

	public int getHits() {
		return hits;
	}
	
	public void addMisses(int num){
		misses += num;
	}

	public void incrementMisses(){
		misses++;
	}
	
	public int getMisses() {
		return misses;
	}
	
	
	public String toString(){
		return ToStringBuilder.reflectionToString(this);
	}

	public String getEpoch() {
		return epoch;
	}

	public void setEpoch(String epoch) {
		this.epoch = epoch;
	}

	public String getPart() {
		return part;
	}

	public void setPart(String part) {
		this.part = part;
	}

	public String getPersonName() {
		return personName;
	}

	public void setPersonName(String personName) {
		this.personName = personName;
	}
	
	

}
